package com.cgbl.service.utils.city;

import com.robot.base.model.ConfirmOrderProductBean;
import com.robot.base.model.MemberAdapterBean;
import com.robot.base.model.ShopCartBean;
import com.robot.base.model.UserInfoBean;
import com.tencent.connect.UserInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class BeanTransferHelper {
    public static List<MemberAdapterBean> userInfoTransferMemberAdapter(List<UserInfoBean> userInfoBeans) {
        List<MemberAdapterBean> memberAdapterBeans = new ArrayList<>();
        for (UserInfoBean user : userInfoBeans) {
            MemberAdapterBean memberAdapterBean = new MemberAdapterBean();
            memberAdapterBean.setAccountHead(user.getHead());
            memberAdapterBean.setAccountName(user.getNickName());
            memberAdapterBean.setAccountId(user.getId());
            memberAdapterBean.setCareer(user.getCareer());
            memberAdapterBean.setAccountPhone(user.getMobile());
            memberAdapterBean.setAccountLabel("");
            memberAdapterBeans.add(memberAdapterBean);
        }
        return memberAdapterBeans;
    }

    public static List<ConfirmOrderProductBean> cartsTransferConfirmOrderProduct(List<ShopCartBean> cartBeans) {
        List<ConfirmOrderProductBean> confirmOrderProductBeans = new ArrayList<>();
        for (ShopCartBean cart : cartBeans) {
            ConfirmOrderProductBean confirmOrderProductBean = new ConfirmOrderProductBean();
            confirmOrderProductBean.setProjectId(cart.getProductId());
            confirmOrderProductBean.setPrice(cart.getCourseInfoDTO().getRulingPrice());
            confirmOrderProductBean.setVipPrice(cart.getCourseInfoDTO().getClassVipPrice());
            confirmOrderProductBean.setProjectType(cart.getType());
            confirmOrderProductBean.setProjectName(cart.getCourseInfoDTO().getCourseName());
            confirmOrderProductBean.setProjectCover(Objects.requireNonNull(cart.getCourseInfoDTO().getInfoFileRespVOS()).get(0).getFilePath());
            confirmOrderProductBeans.add(confirmOrderProductBean);
        }
        return confirmOrderProductBeans;
    }

    public static List<ConfirmOrderProductBean> createConfirmOrderProductByCourse(String project) {
        List<ConfirmOrderProductBean> confirmOrderProductBeans = new ArrayList<>();
        ConfirmOrderProductBean confirmOrderProductBean = new ConfirmOrderProductBean();
        confirmOrderProductBean.setProjectId(project);
        confirmOrderProductBean.setProjectType("1");
        confirmOrderProductBeans.add(confirmOrderProductBean);
        return confirmOrderProductBeans;
    }
}
